#include <stdio.h>
#include <string.h>

#define N 15

void print_all(const int a[][N], int row, int column)
{
        for (int i = 0; i < row; i++) {
                for (int j = 0; j < column; j++)
                        printf("%4d", a[i][j]);
                printf("\n");
        }
}

void spiral_matrix(int a[][N], int m, int n)
{
        memset(a, 0, sizeof(int) * N * N);
        int dr[] = {1, 0, -1, 0},
                dc[] = {0, 1, 0, -1};
        int r = 0, c = 0, di = 0;
        int k;
        for (int k = 0; k < m * n; k++)
        {
                a[r][c] = k + 1;
                int xr = r + dr[di], xc = c + dc[di];
                if (0<=xr&&xr<m&&0<=xc&&xc<n&&!a[xr][xc])
                        r = xr, c = xc;
                else {
                        di = (di + 1) % 4;
                        r += dr[di];
                        c += dc[di];
                }
        }
        print_all(a, m, n);
}

int main()
{
        int a[N][N];
        int n;
        scanf("%d", &n);
        spiral_matrix(a, n, n);
        return 0;
}